import scala.io.StdIn

object Exercise02 {
  def main(args: Array[String]): Unit ={
    val classNum = 3
    val stuNum = 5
    var score = 0.0
    var classScore = 0.0
    var totalScore=  0.0
    var passNum = 0

    for(i<-1 to classNum){
      classScore = 0.0
      for(j<-1 to stuNum){
        println("请输入第%d班级的%d个学生成绩\n",i,j)
        score = StdIn.readDouble()
        if (score >= 60){
          passNum += 1
        }
        classScore += score
      }
      totalScore += classScore
      println("第%d班级的平均分为%.2f\n",i,classScore / stuNum)
    }
    println("所有班级的平均人数为%.2f", totalScore / (stuNum * classScore))
    println("所有班级的及格人数为%d",passNum)
  }

}
